﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
class Program
{
    private static Timer timer;
    private static Timer timer1;
    private static void OnTimedEvent1(Object souce, ElapsedEventArgs e)
    {
        Console.WriteLine("嘀嗒...");
    }
    private static void OnTimedEvent2(Object souce, ElapsedEventArgs e)
    {
        Console.WriteLine("铃铃铃...闹钟响了！");
    }
    static void Main(string[] args)
    {
        timer = new Timer(1000); 
        timer.Elapsed += OnTimedEvent1; 
        timer.AutoReset = true; 
        timer.Enabled = true; 
        timer1 = new Timer(5000);
        timer1.Elapsed += OnTimedEvent2;
        timer1.AutoReset = true;
        timer1.Enabled = true;
        Console.WriteLine("按 Enter 键停止程序...");
        Console.ReadLine(); // 防止主线程退出
    }
}

